<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="/struts-tags" prefix="s" %>  
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style>
	.text{}
</style>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-3.2.0.js">
</script>
<script type="text/javascript" >
	var flag = false;
	function deleteOrder(id,status){
		$.ajaxSettings.async = false;
		$.post("orderAction_deleteOrder.action", {'id':id,'status':status}, function(total){
			/* 	alert(${session.forder.totalmount});
			 $("#total").html(${session.forder.totalmount}); //所有商品的小计
			var yunfei = $("#yunfei").html();
			$("#totalAll").html(${session.forder.totalmount}); //所有商品小计和运费的和  */
		});
		flag = true;
		check(flag);
	}	
	function check(f){
		if(f){
			location.reload(); 
		}
		$.ajaxSettings.async = true;
	}
			

</script>
<link href="css/footer.css" type="text/css" rel="stylesheet"/>
</head>
<body>
			<div id="shopping_cart">
				<br>
				<div id="head" align="center">
				<c:if test="${session.sta eq 0 }">
				<h2 align="center" style="margin-right: 700px">未完成订单</h2>
				</c:if>
				<c:if test="${session.sta eq 1 }">
				<h2 align="center" style="margin-right: 700px">已完成订单</h2>
				</c:if>
				<table  cellpadding="0" cellspacing="0" >
					<tr>
						<th class="" width="40px">序号</th>
						<th class="" width="100px">商家名称</th>
						<th class="" width="80px">下单人</th>
						<th class="" width="100px">联系电话</th>
						<th class="" width="200px">地址</th>
						<th class="" width="150px">下单时间</th>
						<th class="" width="70px">下单金额</th>
						<th class="" width="70px">订单详情</th>
						<th class="" width="50px">删除</th>
						
				</tr>
					<c:if test="${session.sta eq 0 }">
					<c:forEach items="${session.noneOrder }" var="sorder" varStatus="num">
						
						<tr lang="${sorder.id}">
							 <td align="center" >${num.index+1 }
							</td> 
							<td align="center">${sorder.sellername }
							</td>
							<td align="center">${sorder.name }
							</td>
							<td align="center">${sorder.phone }
							</td>
							<td align="center">${sorder.address }
							</td>
							<td align="center">
								<span id="price">${sorder.date }</span>	
							</td>
							<td align="center">
	 							<span>${sorder.totalmount }元</span>		
							</td >
							<td align="center">
								<a href="shopAction_queryShop.action?orderid=${sorder.id}"><span  id="count_${num.index+1 }">订单详情</span></a>
							</td>
			 				<td align="center" >
								<a href="javascript:void(1)" onclick="deleteOrder(${sorder.id},${sorder.status })" ><br><img src="${pageContext.request.contextPath}/images/remove.png"></a>
							</td> 
						</tr>
						<tr style="height:5px">
							</tr>
					</c:forEach>
					</c:if>
					<c:if test="${session.sta eq 1 }">
					<c:forEach items="${session.doneOrder }" var="sorder" varStatus="num">
						
						<tr lang="${sorder.id}">
							 <td align="center" >${num.index+1 }
							</td> 
							<td align="center">${sorder.sellername }
							</td>
							<td align="center">${sorder.name }
							</td>
							<td align="center">${sorder.phone }
							</td>
							<td align="center">${sorder.address }
							</td>
							<td align="center">
								<span id="price">${sorder.date }</span>	
							</td>
							<td align="center">
	 							<span>${sorder.totalmount }元</span>		
							</td >
							<td align="center">
								<a href="shopAction_queryShop.action?orderid=${sorder.id}"><span  id="count_${num.index+1 }">订单详情</span></a>
							</td>
			 				<td align="center" >
								<a href="javascript:void(1)" onclick="deleteOrder(${sorder.id},${sorder.status })" ><br><img src="${pageContext.request.contextPath}/images/remove.png"></a>
							</td> 
						</tr>
						<tr style="height:5px">
							</tr>
					</c:forEach>
					</c:if>
				</table>
				</div>
				<br>
			
				<div align="right" style="margin-right: 350px">
			
					
				</div>
			</div>
</body>
</html>